Table of Contents

Environment

This page should give you a brief overview about available variables and constants you can use in plugin or template development.

Global Variables

$ACT

Holds the current action, see Action Modes. (reference)

:!: $ACT can also be an array instead of a string depending on when it is used. So if you compare it using a string comparison function (e.g. strcmp(), strncmp()) then you better make sure that it is not an array using !is_array($ACT). Otherwise the result may be undefined. :!:

:!: If you are handling an ACTION_ACT_PREPROCESS event, use $event->data instead of $ACT.

$auth

The globally available $auth object represents an instance of the used authentication plugin, which inherites from AuthPlugin. (reference)

$conf

The globally available $conf array holds all of DokuWiki's configuration settings. In general it follows the following structure:

Normally you don't need to access this array directly. Both, Plugins and Templates have their own methods to accessing their respective configuration settings.

(reference)

$ID

Holds the pagename of the currently rendered page. This page is usually the currently viewed page, but not necessarily - see the $INFO['id'] below. (reference)

$INFO

This is an associative array, populated with information provided by inc/common.php function pageinfo().

Current elements are:

On $INFO array is an example array dumped.

$lang

An associative array which hold all translation strings of the interface, plugins and templates. (reference)

$REV

Holds the revision timestamp of the currently rendered page. This is '' (empty string) when the most current page is meant. (reference)

$_SERVER['REMOTE_USER']

This variable is explicitly set by DokuWiki's authentication mechanism when a user logs in and holds the users name.

$userid = $INPUT->server->str('REMOTE_USER');

$TEXT

On save and preview this global variable holds the text submitted via the edit form. (reference)

$TOC

This variable will, if populated, be used by tpl_toc() to build the TOC of a page. Normally this variable is empty and tpl_toc() builds the TOC from the page metadata. (reference)

$USERINFO

An globally available associative array which hold some information of an authenticated user.

If logged out, or not logged in, this global is set to null.

(reference )

The array is filled in auth_setCookie() after login, or from existing session auth_login(). Or if the authentication plugin uses trustExternal(), it is already set there.

$JSINFO

This array contained information that is passed to the JavaScript as global variable.

Read more:

Constants

Here follows a list of the most important constants.

AUTH_<*>

The AUTH_<*> type constants represent the permission levels, as integer value, used in DokuWiki's ACL system. They can be used to let ACL checks for a given page/namespace look a little bit more verbose.

if (auth_quickaclcheck($ID) >= AUTH_READ) {
    // do sth.
}

AUTH_NONE

AUTH_READ

AUTH_EDIT

AUTH_CREATE

AUTH_UPLOAD

AUTH_DELETE

AUTH_ADMIN

DOKU_<*>

The DOKU_<*> type constants hold information about various system information for DokuWiki's internal use.

DOKU_BASE

The URL base of the DokuWiki install. (reference)

/dokuwiki/

Or if canonical is set:

http://domain.org/dokuwiki/

DOKU_REL

The URL base path to the DokuWiki install. (reference)

/dokuwiki/

DOKU_URL

The absolute URL to the DokuWiki install. (reference)

http://domain.org/dokuwiki/

DOKU_INC

The server side include path of the DokuWiki install. (reference)

/var/www/dokuwiki/

DOKU_CONF

The server side conf path of the DokuWiki install. (reference)

/var/www/dokuwiki/conf/  

DOKU_TPL

(deprecated) The URL base path to the current used template. (reference)

/dokuwiki/lib/tpl/<template>/

Or if canonical is set:

http://domain.org/lib/tpl/<template>/

Note: this define is deprecated and should be replaced by call to tpl_basedir().

DOKU_TPLINC

(deprecated) The server side include path of the current used template. (reference)

/var/www/dokuwiki/lib/tpl/<template>/

Note: this define is deprecated and should be replaced by call to tpl_incdir().

DOKU_PLUGIN

The server side include path of the plugins install. (reference)

/var/www/dokuwiki/lib/plugins/

Request Variables

Since 2012-09-10 “Adora Belle”, request variables are accessible through the Input class. For further information please have a look at request_vars.